var over = 0;
var action = 0;

var thisPage = {
    first: 0,
    _rows: 0,
    // 初始化页面
    OnPageLoad: function () {
        setTimeout(function () {
            $('#loading').hide();
        }, 300);
    },
    DoSyncLinesData: function () {
        let invoiceNo = $.trim($("#InvoiceNo").val());
        let invoiceDate = '';
        if ($.trim($("#InvoiceDate").val()) !== '') {
            let _tmpArr = $.trim($("#InvoiceDate").val()).split("、");
            invoiceDate = $.trim($("#InvoiceDate").val()); // _tmpArr[0] + '-' + _tmpArr[1] + '-01';
        }
        let taxRate = $.trim($("#TaxRate").val());

        parent._InstancePageLines.OnSyncLinesData(invoiceNo, invoiceDate, taxRate);
        closePopupWnd();
    }
};

//-----------------------------------------------------------------------------
// 页面初始化
//-----------------------------------------------------------------------------
function onPageReady() {
    // 发票日
    window.laydate.render({
        elem: '#InvoiceDate',
        format: 'yyyy、MM',
        theme: '#393D49',
        trigger: 'click'
    });

    thisPage.OnPageLoad();
}

// 画面大小或者位置移动
function onPageResize() {
}

//-----------------------------------------------------------------------------
// 验证函数
//-----------------------------------------------------------------------------
$.validator.setDefaults({
    ignore: 'hidden, [reaonly=readonly]'
});
$.validator.addMethod("valueNotEquals", function (value, element, arg) {
    return arg !== value;
}, "Value must not equal arg.");

$(function () {
    $("#form_data").validate({
        // Step 1：设置验证规则和错误消息
        rules: {

        },
        messages: {

        },
        // Step 2：设置验证触发事件
        onclick: false,
        onfocusout: false,
        onfocusin: false,
        onkeyup: false,
        onkeydown: false,
        focusInvalid: false,
        // Step 3：设置错误信息提示
        showErrors: window.showErrors  //使用自定义的错误显示方法
    });
});